#include "status.h"
#include "ui_status.h"
#include <QFile>
#include <QDebug>

Status::Status(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Status)
{
    ui->setupUi(this);
    m_timer = new QTimer(this);
    connect(m_timer,&QTimer::timeout,this,[=](){
        ui->labelstatus->setText("");
    });
}

Status::~Status()
{
    delete ui;
}

void Status::onReceiveMessage(const QString &msg)
{
    ui->labelstatus->setText(msg);

    // 如果定时器正在运行，先停止它
    if (m_timer->isActive()) {
        m_timer->stop();
    }
    m_timer->start(3000);
}

